#ifndef __PVMSOFTMIXER_H__
#define __PVMSOFTMIXER_H__

#include "pvm/pvmapi.h"
#include "lib/pvmsystem.h"

class IPVMVoice;
class PVMVoiceSlot;

class IPVMSoftMixer
{
protected:
	IPVMSoftMixer() {};
public:
	virtual ~IPVMSoftMixer() {};

	virtual void ResizeRenderBuffer(pvm_uint32 bufferSizeInBytes) = 0;
	virtual pvm_uint32 GetRenderBufferSizeInBytes() = 0;
	virtual pvm_bool HasMoreData() = 0;
	virtual pvm_uint32 FillBuffer(void * buffer, pvm_uint32 bufferSizeInSamples) = 0;

	virtual void StopAll() = 0;

	virtual pvm_bool Init(pvm_uint32 maxVoices, pvm_uint32 sampleRate, pvm_uint32 bitsPerSample, pvm_uint32 chanelsNum) = 0;
	virtual void DeInit() = 0;
	virtual pvm_bool IsInitialized() = 0;
	virtual pvm_uint32 GetMaxVoices() = 0;

	virtual void SetGlobalVolume(pvm_uint32 volume) = 0;
	virtual pvm_uint32 GetGlobalVolume() = 0;

	virtual pvm_int32 Play(IPVMVoice *chanel, pvm_uint32 voiceNumAndFlags, TVoiceCallbackProc callbackProc, pvm_uint32 callbackPeriod, void* calbackParam) = 0;
	virtual pvm_bool Stop(pvm_uint32 chanelNum) = 0;
	virtual pvm_bool IsVoiceFree(pvm_uint32 chanelNum) = 0;

	virtual pvm_bool SetPanning(pvm_uint32 chanelNum, pvm_int32 value) = 0;
	virtual pvm_bool SetVolume(pvm_uint32 chanelNum, pvm_int32 value) = 0;
	virtual pvm_bool SetLoopCount(pvm_uint32 chanelNum, pvm_int32 value) = 0;
	virtual pvm_bool SetLoopInSamples(pvm_uint32 chanelNum, pvm_int64 loopFrom, pvm_int64 loopTo) = 0;
	virtual pvm_bool SetPause(pvm_uint32 chanelNum, pvm_bool value) = 0;
	virtual pvm_bool SetRenderSilentVoice(pvm_uint32 chanelNum, pvm_bool value) = 0;
	virtual pvm_bool SetRate(pvm_uint32 chanelNum, pvm_int32 value) = 0;

	virtual pvm_bool GetPanning(pvm_uint32 chanelNum, pvm_int32& value) = 0;
	virtual pvm_bool GetVolume(pvm_uint32 chanelNum, pvm_int32& value) = 0;
	virtual pvm_bool GetLoopCount(pvm_uint32 chanelNum, pvm_int32& value) = 0;
	virtual pvm_bool GetLoopInSamples(pvm_uint32 chanelNum, pvm_int64 &loopFrom, pvm_int64 &loopTo) = 0;
	virtual pvm_bool GetLoopInMS(pvm_uint32 chanelNum, pvm_int32 &loopFrom, pvm_int32 &loopTo) = 0;
	virtual pvm_bool GetPause(pvm_uint32 chanelNum, pvm_bool& value) = 0;
	virtual pvm_bool GetRenderSilentVoice(pvm_uint32 chanelNum, pvm_bool& value) = 0;
	virtual pvm_bool GetRate(pvm_uint32 chanelNum, pvm_int32& value) = 0;

	virtual pvm_bool SetPositionMS(pvm_uint32 chanelNum, pvm_int32 value) = 0;
	virtual pvm_bool GetPositionMS(pvm_uint32 chanelNum, pvm_int32& value) = 0;

	virtual pvm_bool SetOption(const pvm_char* optionName, void* param, pvm_uint32 paramSize) = 0;
	virtual pvm_bool GetOption(const pvm_char* optionName, void* param, pvm_uint32* paramSize) = 0;

	virtual pvm_bool SetVoiceOption(pvm_uint32 chanelNum, const pvm_char* optionName, void* param, pvm_uint32 paramSize) = 0;
	virtual pvm_bool GetVoiceOption(pvm_uint32 chanelNum, const pvm_char* optionName, void* param, pvm_uint32* paramSize) = 0;

	virtual pvm_bool BeginBatchParams() = 0;
	virtual void EndBatchParams() = 0;

	virtual pvm_bool SetPanningVolumeRateFast(pvm_uint32 chanelNum, pvm_int32 panning, pvm_int32 volume, pvm_int32 rate) = 0;

	virtual void OnIdle() = 0;
	virtual void SetForceProcessingOnIdle(pvm_bool flag) = 0;
};

#endif
